package com.ehualu.esresult.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Author: 吴敬超
 * @Date: 2020/7/9 11:53
 */
public class ESserversUtil {
    private static final Logger LOG = LoggerFactory.getLogger(ESserversUtil.class);

    public static String esServers = "es.servers";

    public static String getESser() {


        String esuserserver = "";



        LoadProperties loadProc = LoadProperties.getInstance();


        String esport = loadProc.getValues(esServers, "192.168.22.14:9200");

        LOG.info("esport is " + esport);

        String[] es = esport.split(",");
        int rannum = (int) (Math.random() * es.length);

        esuserserver = es[rannum];
        LOG.info("esuserserver is " + esuserserver);


        return esuserserver;


    }
}
